package com.isunland.managesystem.utils;

import android.widget.Toast;
import com.isunland.managesystem.R;
import com.isunland.managesystem.common.MyApplication;

public class ToastUtil {
  public static void show(String message) {
    Toast.makeText(MyApplication.getAppContext(), message, Toast.LENGTH_SHORT).show();
  }

  public static void show(String message, String defaultMessage) {
    if (message == null) message = "";
    if (defaultMessage == null) defaultMessage = "";
    message = MyStringUtil.isEmpty(message) ? defaultMessage : message;
    Toast.makeText(MyApplication.getAppContext(), message, Toast.LENGTH_SHORT).show();
  }

  @SuppressWarnings("unused") public static void showLong(String message) {
    Toast.makeText(MyApplication.getAppContext(), message, Toast.LENGTH_LONG).show();
  }

  public static void show(int resId) {
    Toast.makeText(MyApplication.getAppContext(), resId, Toast.LENGTH_SHORT).show();
  }

  @SuppressWarnings("unused") public static void showEmpty(String message) {
    String suffix = MyApplication.getAppContext().getString(R.string.notEmpty);
    Toast.makeText(MyApplication.getAppContext(), message + suffix, Toast.LENGTH_SHORT).show();
  }

  public static void showEmpty(int resId) {
    String message = MyApplication.getAppContext().getString(resId);
    String suffix = MyApplication.getAppContext().getString(R.string.notEmpty);
    Toast.makeText(MyApplication.getAppContext(), message + suffix, Toast.LENGTH_SHORT).show();
  }
}
